using Microsoft.VisualStudio.Modeling.Diagrams;

namespace Microsoft.Modeling.StoryboardDesigner
{
    /// <summary>
    /// TextField subclass: has additional property that returns the
    /// size required to display the text field.
    /// </summary>
    public class DemoTextField : TextField
    {
        #region Added methods

        /// <summary>
        /// Returns the size required to display all of the text in the
        /// field
        /// </summary>
        /// <param name="parentShape"></param>
        /// <returns></returns>
        public SizeD GetRequiredTextSize(ShapeElement parentShape)
        {
            return this.MeasureDisplayText(
                this.GetDisplayText(parentShape),
                this.GetFont(parentShape),
                this.GetStringFormat(parentShape),
                parentShape.MaximumSize);
        }

        #endregion

        public DemoTextField(string fieldName)
            : base(fieldName)
        {
        }
    }
}